package com.aipsi.cws.supplier.domain;

import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.TableId;
import lombok.*;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;


@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
public class Supplier implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 账户
     */
    private Integer accountId;

    /**
     * 名称
     */
    @TableId(value = "supplier_name")
    private String supplierName;

    /**
     * 法人
     */
    private String legalPerson;

    /**
     * 手机号码
     */
    @Pattern(regexp = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(16[5,6])|(17[0-8])|(18[0-9])|(19[1、5、8、9]))\\d{8}$",message = "手机号码格式错误")
    private String mobileNumber;

    /**
     * 电话号码
     */
    @Pattern(regexp = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(16[5,6])|(17[0-8])|(18[0-9])|(19[1、5、8、9]))\\d{8}$",message = "电话号码格式错误")
    private String phoneNumber;

    /**
     * 地址
     */
    private String address;

    /**
     * 欠款
     */
    @Min(value = 0,message = "欠款不能小于0")
    private Integer debt;

    /**
     * 中行账号
     */
    @Length(min = 19,max = 19,message = "账号格式错误")
    private String bocAccount;

    /**
     * 农行账号
     */
    @Length(min = 19,max = 19,message = "账号格式错误")
    private String abcAccount;

    /**
     * 工行账号
     */
    @Length(min = 19,max = 19,message = "账号格式错误")
    private String icbcAccount;

    /**
     * 建行账号
     */
    @Length(min = 19,max = 19,message = "账号格式错误")
    private String ccbAccount;

    /**
     * 交行账号
     */
    @Length(min = 19,max = 19,message = "账号格式错误")
    private String bocomAccount;

    /**
     * 招行账号
     */
    @Length(min = 19,max = 19,message = "账号格式错误")
    private String cmbAccount;

    /**
     * 其他账号
     */
    @Length(min = 19,max = 19,message = "账号格式错误")
    private String otherAccount;

    public void setDebt(Integer debt) {
        this.debt = debt>=0?debt:0;
    }
}
